@echo off
chcp 65001 >nul
echo ============================================
echo Workflow Manager - Build Script
echo ============================================

REM Change to project root
cd /d "%~dp0"

echo.
echo [1/2] Building MCP Server (with console)...
go build -o bin\workflow-mcp-server.exe .\cmd\mcp-server
if %ERRORLEVEL% NEQ 0 (
    echo ERROR: MCP Server build failed
    exit /b 1
)
echo     OK: bin\workflow-mcp-server.exe

echo.
echo [2/2] Building GUI Service (without console)...
go build -ldflags="-H windowsgui" -o bin\workflow-gui-server.exe .\cmd\gui-server
if %ERRORLEVEL% NEQ 0 (
    echo ERROR: GUI Service build failed
    exit /b 1
)
echo     OK: bin\workflow-gui-server.exe

echo.
echo ============================================
echo Build completed successfully!
echo ============================================
echo.
echo MCP Server: bin\workflow-mcp-server.exe (with console)
echo GUI Service: bin\workflow-gui-server.exe (no console)
echo.
